home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1984 September / 1984-09.d64 / disk tricks 4 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  1KB  |  32 lines

  1. 100 sys65517:ifpeek(781)=22thenmt$="":tm$="":goto500
  2. 110 mt$="":tm$=""
  3. 500 print"[147]"mt$"     warning":print" this program will"
  4. 501 print" scratch[146] a file.":print" please make sure"
  5. 502 print" that the gazette disk[146]":printtm$" is not in the drive."
  6. 1000 fori=1to7000:next
  7. 3999 rem end: rem program 4, scratch or scratch and leave on directory
  8. 4000 print"[147]select option:"
  9. 4010 print"1. complete scratch"
  10. 4020 print"2. scratch, but leave"
  11. 4021 print"   on directory"
  12. 4030 print"which one?"
  13. 4040 get a$: if a$="" then 4040
  14. 4050 a=val(a$): if a<1 or a>2 then 4040: rem reject invalid input
  15. 4060 if a=1 then b=0: rem set to permanently delete
  16. 4070 if a=2 then b=128: rem set to leave on directory
  17. 4080 input"which sector";s$: s=val(s$): if s<0 or s>19 then 4080
  18. 4090 print "what is the first byte":print"of the file you wish"
  19. 4091 print "to scratch?"
  20. 4100 input bp$: bp=val(bp$): rem input file target byte for scratch
  21. 4110 bs=(bp=2)+(bp=34)+(bp=66)+(bp=98)+(bp=130)+(bp=162)+(bp=194)+(bp=226)
  22. 4120 ifbs<>-1then4100:rem reject invalid input
  23. 4130 open 15,8,15,"i": rem open command channel to disk
  24. 4140 open8,8,8,"#": rem open direct access channel to disk
  25. 4150 print#15, "u1:"8;0;18;s: rem load sector containing file to be scratched
  26. 4160 print#15, "b-p:"8;bp: rem set buffer pointer to target address
  27. 4170 print#8, chr$(b);: rem change target file code in channel 8 buffer
  28. 4180 print#15,"u2:"8;0;18;s:rem return changed contents to target sector
  29. 4190 close 8: rem close direct access channel
  30. 4200 close 15: rem close command channel
  31. 4210 rem goto 100: rem restart display t&s program when first rem removed
  32.